package com.itheima.controller;

import com.itheima.domain.SmsHomeBrand;
import com.itheima.manager.SmsHomeBrandManager;
import com.itheima.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author ChenTianSui
 * @date 2022/11/12 19:24
 */
@RestController
@RequestMapping("/home/brand")
public class SmsHomeBrandController {
    @Autowired
    private SmsHomeBrandManager smsHomeBrandManager;

    /**
     * 添加首页推荐品牌
     *
     * @return
     */
    @PostMapping("/create")
    public R create(@RequestBody List<SmsHomeBrand> homeBrandList) {
        return smsHomeBrandManager.create(homeBrandList);

    }

    @PostMapping("/delete")
    public R delete(@RequestParam List<Integer> ids) {
        return smsHomeBrandManager.delete(ids);

    }

    @PostMapping("/update/sort/{id}")
    public R updateSortById(@PathVariable Integer id, @RequestParam(required = false) Integer sort) {
        return smsHomeBrandManager.updateSortById(id, sort);

    }

}
 
